From d9bad36a8f7530ec17ffe93521a8a71bc1e54a20 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 15 Dec 2022 16:15:27 +0000
Subject: [PATCH] dt: Add camX_reg and camX_reg_gpio overrides to CM4S

CM4S follows the pattern of CM1&3 for routing camera
GPIO control, but didn't have the overrides defined to
allow enabling and configuring the camera regulator
GPIOs. Add them.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 arch/arm/boot/dts/bcm2711-rpi-cm4s.dts | 9 +++++++--
 arch/arm/boot/dts/overlays/README      | 4 ++--
 2 files changed, 9 insertions(+), 4 deletions(-)

--- a/arch/arm/boot/dts/bcm2711-rpi-cm4s.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-cm4s.dts
@@ -403,12 +403,12 @@
 };
 
 &cam1_reg {
-	gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
+	gpio = <&gpio 3 GPIO_ACTIVE_HIGH>;
 	status = "disabled";
 };
 
 cam0_reg: &cam0_regulator {
-	gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
+	gpio = <&gpio 31 GPIO_ACTIVE_HIGH>;
 	status = "disabled";
 };
 
@@ -423,5 +423,10 @@ cam0_reg: &cam0_regulator {
 		sd_poll_once = <&emmc2>, "non-removable?";
 		spi_dma4 = <&spi0>, "dmas:0=", <&dma40>,
 			   <&spi0>, "dmas:8=", <&dma40>;
+
+		cam0_reg = <&cam0_reg>,"status";
+		cam0_reg_gpio = <&cam0_reg>,"gpio:4";
+		cam1_reg = <&cam1_reg>,"status";
+		cam1_reg_gpio = <&cam1_reg>,"gpio:4";
 	};
 };
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -148,7 +148,7 @@ Params:
                                 Only required on CM1 & 3.
 
         cam0_reg_gpio           Set GPIO for CAM 0 regulator.
-                                Default 31 on CM1 & 3.
+                                Default 31 on CM1, 3, and 4S.
                                 Default of GPIO expander 5 on CM4, but override
                                 switches to normal GPIO.
 
@@ -156,7 +156,7 @@ Params:
                                 Only required on CM1 & 3.
 
         cam1_reg_gpio           Set GPIO for CAM 1 regulator.
-                                Default 3 on CM1 & 3.
+                                Default 3 on CM1, 3, and 4S.
                                 Default of GPIO expander 5 on CM4, but override
                                 switches to normal GPIO.
 
